import axios from 'axios'
import {commonConfig} from "@/config/api-config/config";
const debug = process.env.NODE_ENV !== 'production'


export async function getBanner() {
    const url = debug ? '/api/banner' : 'http://ustbhuangyi.com/music/api/getTopBanner'
    let param = {
        '-': "recom" + (Math.random() + "").replace("0.", ""),
        sign: 'zzai8a0od7p9u1670afea6f1fed9051d1daae90617db9',
        data: {
            "comm": {"ct": 24},
            "category": {"method": "get_hot_category", "param": {"qq": ""}, "module": "music.web_category_svr"},
            "recomPlaylist": {
                "method": "get_hot_recommend",
                "param": {"async": 1, "cmd": 2},
                "module": "playlist.HotRecommendServer"
            },
            "playlist": {
                "method": "get_playlist_by_category",
                "param": {"id": 8, "curPage": 1, "size": 40, "order": 5, "titleid": 8},
                "module": "playlist.PlayListPlazaServer"
            },
            "new_song": {"module": "newsong.NewSongServer", "method": "get_new_song_info", "param": {"type": 5}},
            "new_album": {
                "module": "newalbum.NewAlbumServer",
                "method": "get_new_album_info",
                "param": {"area": 1, "sin": 0, "num": 20}
            },
            "new_album_tag": {"module": "newalbum.NewAlbumServer", "method": "get_new_album_area", "param": {}},
            "toplist": {"module": "musicToplist.ToplistInfoServer", "method": "GetAll", "param": {}},
            "focus": {"module": "QQMusic.MusichallServer", "method": "GetFocus", "param": {}}
        }
    }
    const query = Object.assign({},commonConfig,param)
    let result = await axios.get(url,{
        params:query
    })
    return result.data
}

export async function getDisc() {
    const url = debug ? '/api/disc' : 'http://ustbhuangyi.com/music/api/getDiscList'
    let param = {
        picmid: 1,
        rnd: Math.random() + "",
        g_tk_new_20200303: 5381,
        categoryId: 10000000,
        sortId: 5,
        sin: 0,
        ein: 19
    }
    const query = Object.assign({},commonConfig,param)
    let result = await axios.get(url,{
        params:query
    })
    return result.data
}

